StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (actor)->priv;
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
ClutterLayoutManager *layout = clutter_actor_get_layout_manager (actor);
+ ClutterActorBox viewport_content_box;
ClutterActorBox content_box;
gfloat avail_width, avail_height, min_width, natural_width, min_height, natural_height;
- CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->allocate (actor, box, flags);
-
- st_theme_node_get_content_box (theme_node, box, &content_box);
- clutter_actor_box_get_size (&content_box, &avail_width, &avail_height);
+ st_theme_node_get_content_box (theme_node, box, &viewport_content_box);
+ clutter_actor_box_get_size (&viewport_content_box, &avail_width, &avail_height);
clutter_layout_manager_get_preferred_width (layout, CLUTTER_CONTAINER (actor),
avail_height,
MAX (avail_width, min_width),
&min_height, &natural_height);
+ /* Because StBoxLayout implements StScrollable, the allocation box passed here
+ * may not match the minimum sizes reported by the layout manager. When that
+ * happens, the content box needs to be adjusted to match the reported minimum
+ * sizes before being passed to clutter_layout_manager_allocate() */
+ clutter_actor_set_allocation (actor, box, flags);
+
+ content_box = viewport_content_box;
+ content_box.x2 += MAX (0, min_width - avail_width);
+ content_box.y2 += MAX (0, min_height - avail_height);
+
+ clutter_layout_manager_allocate (layout, CLUTTER_CONTAINER (actor),
+ &content_box, flags);
/* update adjustments for scrolling */
if (priv->vadjustment)